import { homeCategoryHead } from '@/api/home.js'
const state = {
  categoryList: [
    {
      name: '居家',
      id: 1
    },
    {
      name: '美食',
      id: 2
    },
    {
      name: '服饰',
      id: 3
    },
    {
      name: '母婴',
      id: 4
    },
    {
      name: '个护',
      id: 5
    },
    {
      name: '严选',
      id: 6
    },
    {
      name: '数码',
      id: 7
    },
    {
      name: '运动',
      id: 8
    },
    {
      name: '杂项',
      id: 9
    }
  ] // 全部分类
}
const mutations = {
  setCategoryList (state, value) {
    state.categoryList = value
  }
}
const actions = {
  async getCategoryList ({ commit }) {
    const res = await homeCategoryHead()
    commit('setCategoryList', res.result)
    // console.log(res)
  }
}
const getters = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
